package de.graph.common.impl;

import java.util.HashSet;

import de.graph.common.Edge;
import de.graph.common.Vertex;
import de.graph.document.Document;
import de.graph.document.DocumentFactory;

final class VertexFactory {

    private VertexFactory() {
    }

    public static final Vertex create() {
        return create(null);
    }

    public static final Vertex create(String label) {

        Document document = DocumentFactory.create();

        if (label != null && label.length() > 0) {
            document.setProperty(VertexImpl.LABEL, label);
        }
        
        document.setProperty(VertexImpl.OUT_EDGES, new HashSet<Edge>());
        document.setProperty(VertexImpl.IN_EDGES, new HashSet<Edge>());

        return new VertexImpl(document);
    }
}
